package com.fenghuajueli.lib_pictureselect.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.fenghuajueli.lib_pictureselect.R;

/**
 * 处理拷贝媒体文件的对话框
 */
public class HandlerVideoDialog extends Dialog {

    private TextView tvProgressTips;
    private ProgressBar pbCopyProgress;


    public HandlerVideoDialog(Context context) {
        super(context, R.style.StyleBaseDialog);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.handler_video_dialog_layout);
        tvProgressTips = findViewById(R.id.tvProgressTips);
        pbCopyProgress = findViewById(R.id.pbCopyProgress);
        tvProgressTips.setText(getContext().getString(R.string.btn_make_video_dialog_tips, 0));
    }

    /**
     * 设置进度
     *
     * @param progress
     * @param currentPosition
     */
    public void setProgress(int progress, int currentPosition) {
        if (tvProgressTips != null) {
            tvProgressTips.setText(getContext().getString(R.string.btn_make_video_dialog_tips, currentPosition));
        }
        if (pbCopyProgress != null) {
            pbCopyProgress.setProgress(progress);
        }
    }

}
